package com.d0326;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class TestHashMap {
    public static void main(String[] args) {
        Map<String,Student> studentMap=new HashMap<>();
        Student s1=new Student("zhangsan ",22,51);
        Student s2=new Student("lisi ",33,51);
        Student s3=new Student("wangwu ",12,51);
        Student s4=new Student("zhaoliu ",17,51);
        studentMap.put("zs",s1);
        studentMap.put("ls",s2);
        studentMap.put("ww",s3);
        studentMap.put("zl",s4);
        /*System.out.println(studentMap.size());
        Student x1=studentMap.get("zs");
        System.out.println(x1);*/
        /*Collection<Student> values=studentMap.values();
        for (Student stu:
             values) {
            System.out.println(stu);
        }*/
        /*Set<Map.Entry<String,Student>> entys= studentMap.entrySet();
        for (Map.Entry enty:
             entys) {
            System.out.println(enty.getKey()+"--->"+enty.getValue());
        }*/
        studentMap.forEach((s, student) -> System.out.println(s+"==="+student));

    }
}
